home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15724 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  993 b 

  1. Path: nyx.cs.du.edu!not-for-mail
  2. From: anon23bf@nyx.cs.du.edu (A. N. Alias)
  3. Newsgroups: comp.lang.c++
  4. Subject: C++ complex numbers slow as molasses?
  5. Date: 6 Apr 1996 13:30:04 -0700
  6. Organization: University of Denver, Dept. of Math & Comp. Sci.
  7. Message-ID: <4k6k8c$8h4@nyx.cs.du.edu>
  8. NNTP-Posting-Host: nyx.nyx.net
  9. Keywords: Complex.h complex numbers speed
  10.  
  11. I'm using the complex number implementation that came with
  12. GNU C++ (v2.4).  It seems that basic complex arithmetic
  13. (+, -, *, /, exp) runs about 2.5 times slower than when I
  14. code the same thing in C!  I realize that C++ could be a
  15. bit slower, but I thought that the speed difference would
  16. be far less drastic (esp. if the C++ compiler inlines the
  17. arithmetic operators, as the Complex.h declarations specify).
  18. In fact, I've read claims that C++ often runs just as fast
  19. as C for this kind of application.
  20.  
  21. Is this normal?  What, if anything, can I do to speed things
  22. up?  It would be quite tedious to rewrite the code in C.
  23.  
  24. Thanks,
  25.  
  26. -Al
  27.  
  28.